#include <mysqlx/xdevapi.h>
#include <memory>
#include <mutex>

class mysqlx_opt
{
public:
    mysqlx_opt(const std::string& ip, ushort port, const std::string& name,
        const std::string& pwd, const std::string&dbname);
    mysqlx::SqlResult execute(const std::string& sql);
    bool connected(){ if(_session) return true; return false; }
private:
    std::mutex _mutex;
    std::shared_ptr<mysqlx::Session> _session;
};

extern mysqlx_opt g_mysqlx_opt;
